package top.jojoace.demo.Dao;

import lombok.*;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;


//@AllArgsConstructor
@AllArgsConstructor
@ToString
@Setter
@Getter
@Repository
@Lazy   //延迟实例化
/**y
 * <h2>@Primary</h2>
 * <p>对于byType的类型注入中
 * <p>@Primary可提高所注解的类的优先级，使其优先注入</p>
 * <p>byType中，对同一接口的实现类中，@Primary仅可注解其中某一个实现类。即，实现类中注解@Primary的类唯一,否则报错。</p>
 */
@Primary    //优先注入
public class User1 implements UserInterface{

    private String name;
    private int age;

    public User1(){
        System.out.println("Constructor User1...");
    }

    @Override
    public void sayClass() {
        System.out.println("Constructor User1...");
    }
}
